﻿using DotNetCore.MyBlogApi.Data.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace DotNetCore.MyBlogApi.Data.Models
{

    [DBDescription("用户表")]
    public class SysUser
    {
        [DBDescription("主键ID")]
        [Key]
        public Guid SysUserId { get; set; }
        [Required]
        [DBDescription("用户名")]
        public string UserName { get; set; }
        [Required]
        [DBDescription("用户密码")]
        public string Password { get; set; }
        [DBDescription("用户昵称")]
        public string NickName { get; set; }

        [DBDescription("用户手机号码")]
        public string Mobile { get; set; }

        [DBDescription("用户性别")]
        public string Sex { get; set; }

        [DBDescription("用户QQ号码")]
        public string Qq { get; set; }

        [DBDescription("用户邮箱")]
        public string Email { get; set; }

        [DBDescription("用户上次登录时间")]
        public DateTime LastLoginTime { get; set; }
        [DBDescription("用户上次登录Ip地址")]
        public string LastLoginIp { get; set; }

        [DBDescription("用户头像")]
        public string HeadImage { get; set; }

        [DBDescription("是否冻结")]
        public bool IsFreeze { get; set; }

        [DBDescription("是否删除")]
        public bool IsDelete { get; set; }

        [DBDescription("注册时间")]
        public string RegisterTime { get; set; }
        
        [DBDescription("版本说明")]
        [Timestamp]
        public byte[] Version { get; set; }
        
        //导航属性
        //[DBDescription("用户发表的文章")]  //这会生成外键 所以这个字段暂时不能设置说明
        public ICollection<Article> Articles { get; set; }//文章列表
        public ICollection<ArticleTag> ArticleTags { get; set; }//文章标签

        public ICollection<ArticleCategory> ArticleCategories { get; set; }//文章分类

        /// <summary>
        /// 构造函数
        /// </summary>
        public SysUser()
        {
            Articles = new List<Article>();
            ArticleTags = new List<ArticleTag>();
            ArticleCategories = new List<ArticleCategory>();
            IsDelete = false;
            IsFreeze = false;
        }

    }
}
